#ifndef _UNIT_INFO_3D_H_
#define _UNIT_INFO_3D_H_

#include "Ogre.h"

#include <windows.h>

class TextMaterial
{
private:
	Ogre::TexturePtr pTexture ;
	Ogre::MaterialPtr pMaterial ;

	char resourceName[64] ;

	enum {MAX_TEXT_W = 512, MAX_TEXT_H = 32} ;
	static HDC hMemDC ;
	static HBITMAP hBMP ;
	static void* pPixel ;

	int Color ;
	char Text[256] ;

public:
	float u, v ;

	void init () ;
	void setText (const char*, float, float, float) ;
	const Ogre::MaterialPtr& getMaterialPtr () ;

	void release () ;
} ;

class UnitInfo3D
{
private:
	TextMaterial textMaterial ;

	enum {NAME_CHAR_W = 4, NAME_CHAR_H = 6} ;
	enum {HP_BAR_W = 25, HP_BAR_H = 1 } ;
	Ogre::SceneManager* pSceneMgr ;
	Ogre::SceneNode* pNode;

	//name
	Ogre::BillboardSet* pNameBillBoardSet ;
	Ogre::Billboard* pNameBillBoard ;

	//life
	Ogre::BillboardSet* pLifeBillBoardSet ;
	Ogre::Billboard* pLifeBillBoard ;

public:
	UnitInfo3D () ;

	void init (Ogre::SceneManager*) ;
	void setName (const char*) ;
	void work (int, int, float, float, float, float, float, float, float) ;

	void release () ;
} ;

#endif